//
//  NSString+category.h
//  MoCloud
//
//  Created by xj on 2019/5/28.
//  Copyright © 2019 xj. All rights reserved.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface NSString (category)

@property (nullable, nonatomic, readonly) NSString *tj_documentsPath;
@property (nullable, nonatomic, readonly) NSString *tj_cachePath;
@property (nullable, nonatomic, readonly) NSString *tj_tempPath;


- (NSString *)localizedString;

- (nonnull NSString *)replacingEmptyString;

- (nonnull NSString *)getFirstLetterString;

- (nonnull NSAttributedString *)titleMargin:(CGFloat)magrin withAlignment:(NSTextAlignment)alignment;

- (CGSize)getStringSizeWithWidth:(CGFloat)width fontSize:(CGFloat)fontSize;
- (CGSize)getStringSizeWithWidth:(CGFloat)width font:(UIFont *)font;

+ (NSString *)dateStringWithDateFormat:(NSDateFormatter *)dateFormat timeInterval:(NSTimeInterval)timeInterval;




+ (float)floatWithdecimalNumber:(double)num;

+ (double)doubleWithdecimalNumber:(double)num;

+ (NSString *)stringWithDecimalNumber:(double)num;

+ (NSDecimalNumber *)decimalNumber:(double)num;

/** 通过一个位置来设置两段的字符串, 可以设置不同字体大小  */
- (nonnull NSAttributedString *)attributedStringWithLoction:(NSInteger)loction foregroundFont:(CGFloat)foregroundFont backgroundFont:(CGFloat)backgroundFont color:(nonnull UIColor *)color;

/** 通过一个位置来设置两段的字符串, 可以设置不同颜色 */
- (nonnull NSAttributedString *)attributedStringWithLoction:(NSInteger)loction foregroundFont:(CGFloat)foregroundFont backgroundFont:(CGFloat)backgroundFont foregroundcolor:(nonnull UIColor *)foregroundcolor backgroundColor:(nonnull UIColor *)backgroundColor;

/** 通过一个位置来设置两段的字符串, 可以设置不同字体大小, 和字体的粗细  */
- (nonnull NSAttributedString *)attributedStringWithLoction:(NSInteger)loction foregroundFont:(CGFloat)foregroundFont backgroundFont:(CGFloat)backgroundFont weight:(CGFloat)weight color:(nonnull UIColor *)color;

/** 通过开始位置和结束的位置和分成两段, 可以设置不同颜色和字体大小 */
- (nonnull NSAttributedString *)attributedStringWithRanger:(NSRange)ranger foregroundFont:(CGFloat)foregroundFont backgroundFont:(CGFloat)backgroundFont foregroundcolor:(nonnull UIColor *)foregroundcolor backgroundColor:(nonnull UIColor *)backgroundColor;

/** 字符串中设置数字的颜色 */
- (nonnull NSAttributedString *)attributedStringWithNumberString:(nonnull NSString *)numberString numberStringColor:(nullable UIColor *)numberString;

@end

NS_ASSUME_NONNULL_END
